{include file="pageheader_erp.htm"}

{insert_scripts files="../js/jquery.1.3.2.js"}

<style type="text/css">
	#outside_container
	{
		width:100%;
		border:none;
		overflow:hidden;
		text-align:center;
		padding:10px;
		background-color:#F4FAFB;
	}
	#inner_container
	{
		width:45%;
		border:1px solid #DDD;
		overflow:hidden;
		text-align:left;
		background-color:#DDEEF2;
		margin:0 auto;
	}

	
	#inner_container table tr td
	{
		padding:6px;
		font-weight:bold;
		background-color:#FFF;
	}
	
	.tb_lable
	{
		padding-left:20px;
		
	}

</style>


 <!-- start goods list -->
<div class="main-div">
	<div id="outside_container">
		<div id="inner_container">
			<form name="add_warehouse"  id="add_warehouse"  action="javascript:;"  onsubmit="javascript:addWarehouse(this);" method="post">
				<table>
					<tr>
						<td width="20%"><span class="tb_lable">{$lang.erp_warehouse_name}：</span></td>
						<td><input name="warehouse_name" id="warehouse_name" type="text" value="" style="display:block;"/></td>
						<td><span style="color:red;font-weight:normal;">{$lang.erp_required_item}</span></td>
					</tr>
					<tr>
						<td width="20%"><span class="tb_lable">{$lang.erp_warehouse_description}：</span></td>
						<td><input name="warehouse_description"  id="warehouse_description" type="text" value="" size="40" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width="20%"><span class="tb_lable">{$lang.erp_warehouse_administer}：</span></td>
						<td>
							{if $admins}
							<select id="admin_id">
								{foreach from=$admins item=admin}
									<option value='{$admin.user_id}' {if $warehouse_info.admin_id eq $admin.user_id}selected='selected'{/if}>{$admin.user_name}</option>
								{/foreach}
							</select>
							{/if}
						</td>
						<td>&nbsp;</td>
					</tr>
					<tr><td  colspan="3" align="center"><input type="image" src="./images/submit.gif" style="cursor:pointer;" /></td></tr>																									
				</table>
				
				
			</form>
		</div>
	</div>
</div>
<!-- end goods list -->

{literal}
<script language="JavaScript">
   
   function addWarehouseResponse(res){
   	 if(res.error!=0)
	 {
	 	alert(res.message);
	 }
	 else{
	 	 window.document.location="./erp_warehouse_manage.php?act=warehouse_list";
	 }
   }
    function addWarehouse()
	{
		var new_warehouse=new Object();
		
		new_warehouse['name']=$("#warehouse_name").attr('value');
		new_warehouse['description']=$("#warehouse_description").attr('value');
		new_warehouse['admin_id']=$("#admin_id").attr('value');
		
		if(new_warehouse['name']=="")
		{
			alert('{$lang.erp_warehouse_name_required}');
			return;
		}		
	
		Ajax.call('erp_warehouse.php?act=add_warehouse', 'new_warehouse=' + JSON.stringify(new_warehouse), addWarehouseResponse, 'POST', 'JSON');
		
		}   
</script>
{/literal}
{include file="pagefooter.htm"}

